package cn.supermaster.management.web.rest.monitor;

import cn.supermaster.management.common.response.WebResponse;
import cn.supermaster.management.web.service.monitor.IMonitorCacheService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

/**
 * All rights Reserved, Designed By www.super-bytecode.com
 *
 * @ProjectName: supermaster-management
 * @Package: cn.supermaster.management.web.rest
 * @ClassName: MonitorCacheRestController
 * @Description: []
 * <p> </p>
 * @Author: [Lance Ting]
 * @Date: 2021/1/10 17:22
 * @Version: V1.0
 * @Copyright: 2021 www.super-bytecode.comn Inc. All rights reserved.
 * TODO: 注意,本文件Lance Ting所作,如果转载或使用请标明具体出处!
 **/
@RestController
@RequestMapping("/monitor/cache")
public class MonitorCacheRestController {

    @Autowired
    private IMonitorCacheService monitorCacheService;

    @PostMapping("/clearCacheName")
    public WebResponse clearCacheName(String cacheName, ModelMap modelMap) {
        return monitorCacheService.doClearCacheName(modelMap, cacheName);
    }

    @PostMapping("/clearCacheKey")
    public WebResponse clearCacheKey(String cacheName, String cacheKey, ModelMap modelMap) {
        return monitorCacheService.doClearCacheKey(modelMap, cacheName, cacheKey);
    }

    @GetMapping("/clearAll")
    public WebResponse clearAll(ModelMap modelMap) {
        return monitorCacheService.doClearCacheAll(modelMap);
    }
}